<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */


/**
 * Smarty join to string modifier plugin
 *
 * Type:     modifier<br>
 * Name:     join2string<br>
 * Purpose:  simple search/replace
 *
 * @author Novachok Alexandr
 * @param array
 * @param string
 * @param string
 * @return string
 */
function smarty_modifier_join2string($array, $key, $joiner)
{
   if(!is_array($array)) return $array;

   $tmp = array();
   foreach($array AS $k=>$value)
   {
      if(isset($value[$key]))
      {
         $tmp[] = $value[$key];
      }
   }

   if(!empty($tmp)) return (string)implode($joiner, $tmp);
   return '';
}

/* vim: set expandtab: */

?>
